<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset=utf8>
</head>
<body>
  
    <script>
       var str = 'I am cuicui 123456';
       var reg = new RegExp(/\w{3}/);
       var reg = /\d{6}/;

       console.log(reg);
       console.log(typeof reg);
       console.log(reg.constructor);

       //test()匹配true/不匹配false
       console.log(reg.test(str));
       console.log(/\w{88}/.test(str));

       //exec() 匹配返回对象,不匹配返回null
       console.log(reg.exec(str));
       console.log(/\d{88}/.exec(str));

       var res = reg.exec(str);
       console.log(res.index);
       console.log(res[0]);
      

    </script>


    
</body>
</html>